<?php 
include("sesiune.php");
$loginresult = login($_POST['username'],$_POST['password']);
$accessQ = "SELECT access FROM user where username  = '{$_POST['username']}'";
$runQuery = mysql_query ($accessQ, getConnection()) or die (mysql_error());
$result = mysql_fetch_assoc($runQuery);
	
if($loginresult)
	{
	if($result['access'] == 2)
		{
		header('Location: adminPage.php');
		}
	}	
	elseif($result['access'] != 2)
		{
		header('Location: ../frames/home.php');
		}

	else
		{
			echo ("Wrong credentials!");
		}
?>